<template>
  <div class="app-container training_record_list">
    <ul>
      <li v-for="(item, i) in tableData" :key="i">
          <div class="i_name">{{item.paperName}}</div>
          <div class="i_tag"> <dict-tag :options="dict.type.exam_paper_answer_status" :value="item.status"/></div>
          <div class="i_cont">
            <div><span>做题时间：</span><p>{{item.createTime}}</p></div>
            <div><span>系统判分：</span><p>{{item.systemScore}}</p></div>
            <div><span>最终得分：</span><p><el-tag effect="plain"  size="mini">{{item.userScore}}</el-tag></p></div>
            <div><span>试卷总分：</span><p><el-tag effect="info" size="mini">{{item.paperScore}}</el-tag></p></div>
            <div><span>合格分数：</span><p><el-tag type="info" size="mini">{{item.passScore}}</el-tag></p></div>
            <div><span>合格与否：</span>
              <p>
                <el-tag v-if="item.passStatus == '1'" type="success"><dict-tag :options="dict.type.exam_pass_type" :value="item.passStatus"/></el-tag>
                <el-tag v-else type="error"><dict-tag :options="dict.type.exam_pass_type" :value="item.passStatus"/></el-tag>
              </p>
            </div>
            <div><span>正确题数：</span><p>{{item.questionCorrect}}</p></div>
            <div><span>总题数：</span><p>{{item.questionCount}}</p></div>
            <div><span>用时：</span><p>{{item.doTime}}</p></div>
          </div>
          <div class="i_link">
            <!--
            <router-link target="_blank" :to="{path:'/edit',query:{id:item.id}}" >
              <el-button type="text" size="mini">批改</el-button>
            </router-link>
            -->
            <router-link target="_blank" :to="{path:'/read',query:{id:item.id}}" v-if="item.status === 2 ">
              <el-button  type="text"  size="mini">查看试卷</el-button>
            </router-link>
          </div>
      </li>
    </ul>
  </div>
</template>

<script>
import { mapState, mapGetters } from "vuex";
import Pagination from "@/components/Pagination";
import { pageList } from "@/api/examPaperAnswer";
import { scrollTo } from "@/utils/scroll-to";
export default {
  components: { Pagination },
  dicts: ["exam_paper_answer_status","exam_pass_type"],
  data() {
    return {
      queryParam: {
        pageNum: 1,
        pageSize: 10,
      },
      listLoading: false,
      tableData: [],
      total: 0,
      selectItem: {
        systemScore: "0",
        userScore: "0",
        doTime: "0",
        paperScore: "0",
        questionCorrect: 0,
        questionCount: 0,
      },
    };
  },
  created() {
    this.search();
    scrollTo(0, 800);
  },
  methods: {
    search() {
      this.listLoading = true;
      let _this = this;
      pageList(this.queryParam).then((data) => {
        _this.tableData = data.rows;
        _this.total = data.total;
        _this.listLoading = false;
      });
    },
    itemSelect(row, column, event) {
      this.selectItem = row;
    },
    statusTagFormatter(status) {
      //return this.enumFormat(this.statusTag, status)
    },
    statusTextFormatter(status) {
      //return this.enumFormat(this.statusEnum, status)
    },
  },
  computed: {},
};
</script>

<style lang="scss" scoped></style>
